﻿function Save(CaseType, CaseIndex) {
    PaymentDate = document.getElementById("divPaymentDate").value;
    PaymentModeIndex = document.getElementById("divPaymentType").selectedIndex.toString();
    PaymentMode = document.getElementById("divPaymentType").options[PaymentModeIndex].value;
    PaymentRef = document.getElementById("divPaymentRef").value;
    Amount = document.getElementById("divAmount").value;
    Description = document.getElementById("divDescription").value;
    DBNIndex = document.getElementById("divDBNIndex").value;
    Status = document.getElementById("divPaymentStatus").selectedIndex.toString();
    RetValue = Portal.Vision.AddPayment.ServerSideAddPayment(DBNIndex, PaymentDate, PaymentMode, PaymentRef, Amount, Description, Status).value;
    if (RetValue != null) {
        if (RetValue.indexOf("ERROR") != -1) {
            alert(RetValue);
            return;
        }
    }

    Url = RetValue;
    alert("Thêm mới thanh toán thành công!");
    window.open(Url, "_self");
}